package software;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;

public class Mai_done{
	public int Sum_Plates=0;
	public Collection plates=new ArrayList();
	
	public Collection Pla_Read(){
		String sql="{call plates_read()}";
		try{
			Sum_Plates=0;
			Conn dataconn=new Conn();
			dataconn.Create();
			CallableStatement cs=dataconn.CSt_SQL(sql);
			cs.execute();
			ResultSet rs=cs.getResultSet();
			while(rs.next())
			{
				Pla_item plateitem=new Pla_item();
				plateitem.ID=rs.getInt(1);
				plateitem.Nam_Plate=rs.getString(2);
				plateitem.Num_Post=rs.getInt(3);
				plateitem.Num_Clicks=rs.getInt(4);
				plates.add(plateitem);
				plateitem=null;
				Sum_Plates++;
			}
			dataconn.CloseCC();
		}catch(Exception e){
			e.printStackTrace();
		}
		return plates;
	}
	
}